import java.util.LinkedList;
import java.util.Queue;

/**
 * Created by L.jp
 * Description:
 * User: 86189
 * Date: 2021-10-18
 * Time: 16:21
 */
public class RecentCounter {
    Queue<Integer> q;

    public RecentCounter() {
        q=new LinkedList<>();
    }
    public int ping(int t) {
        q.offer(t);
        while(q.peek()<t-3000){
            q.poll();
        }
        return q.size();
    }

}


